<?php
class Home_Controller_Project extends Home_Controller_Base{
    public function init(){
        $this->assign('active','project');
        parent::init();
    }

    //项目列表页
    public function actionList(){
        $this->_setType(array('index'=>PARAM_STRING));
        $index = $this->_get('index');
        $condition = array();
        $indexArr = explode('-', $index);
        $model_project = MONK::getSingleton('Home_Model_Project');
        //融资金额区间列表
        $financings = $model_project->_financing;
        $this->assign('financings',$financings);

        if(count($indexArr) == 4){
            //like s110-
            list($project_category, $project_industry_id, $project_area, $project_bankroll_section) = $indexArr;
            if(!!$project_category) $condition['project_category'] = array('symbol'=>'like','value'=>'%'.$project_category.'%');
            if(!!$project_industry_id) $condition['project_industry_id'] = array('symbol'=>'=','value'=>$project_industry_id);
            if(!!$project_area) $condition['project_area'] = array('symbol'=>'=','value'=>$project_area);
            if(!!$project_bankroll_section) $condition['project_financing_sum'] = array('symbol'=>'nos','value'=>$financings[$project_bankroll_section][MYSQL_WHERE_SYMBOL]);
        }
        //获取项目列表
        $projects = $model_project->get_list($condition);
        $this->assign('projects',$projects);
        //类型列表
        $categorys = $model_project->_project_category;
        $this->assign('categorys',$categorys);
        //行业列表
        $industrys = $model_project->_industry;
        $this->assign('industrys',$industrys);
        //地区列表
        $areas = $model_project->_area;
        $this->assign('areas',$areas);
        //分页
        $totalCount = $model_project->get_all_count_validity_date();
        $pagelink = $this->getDefaultPageLink($indexArr, $totalCount);
        $this->assign('pagelink',$pagelink);
        $this->render();
    }

    //项目详情页
    public function actionDetail(){
        $this->render();
    }

}
